import { execSync } from 'node:child_process'
import path from 'node:path'
import { consola } from 'consola'
import { version } from '../package.json'

// execSync('npm run build', { stdio: 'inherit' })
try {

  let command = 'npm publish --access public'

  if (version.includes('beta'))
    command += ' --tag beta';
  execSync('echo "Hello World!"', { stdio: 'inherit' })
  // execSync(command, { stdio: 'inherit' })
  consola.success('Hello World!')
  console.log(version);
} catch (error) {
  consola.error(new Error(error))
}

// for (const { name } of packages) {
//   execSync(command, { stdio: 'inherit', cwd: path.join('packages', name, 'dist') })
//   consola.success(`Published @vueuse/${name}`)
// }